import Vue from 'vue'
import VueRouter from 'vue-router'
import BookManage from '../views/BookManage'
import AddUser from '../views/AddUser'
import AddAdmin from '../views/AddAdmin'
import Index from '../views/Index'
import BookUpdate from '../views/BookUpdate'
import AdminUpdate from '../views/AdminUpdate'
import AdminManage from '../views/AdminManage'

Vue.use(VueRouter)

const routes = [
  {
    path:"/",
    name:"用户管理",
    component:Index,
    show:true,
    redirect:"/BookManage",
    children:[
      {
        path:"/BookManage",
        name:"用户列表",
        component:BookManage
      },
      {
        path:"/AdminManage",
        name:"管理员列表",
        component:AdminManage
      },
      {
        path:"/AddUser",
        name:"添加用户",
        component:AddUser
      },
      {
        path:"/AddAdmin",
        name:"添加管理员",
        component:AddAdmin
      },
    ]
  },
  {
    path:'/update',
    component:BookUpdate,
    show:false
  },
  {
    path:'/adupdate',
    component:AdminUpdate,
    show:false
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
